{template 'common/header'}
{if $operation == 'display'}
<a href="{php echo $this->createWebUrl('comment_sign',array('op' =>'post'))}" class="btn btn-success"><i class="fa fa-plus"></i> 添加标签</a>
<div class="main panel panel-default">
        <table class="table table-hover">
            <thead class="navbar-inner">
            <tr>
                <th style="width:30px;">ID</th>
                <th>标签名称</th>
                <th>状态</th>
                <th>创建时间</th>
                <th >操作</th>
            </tr>
            </thead>
            <tbody>
            {loop $list $item}
            <tr>
                <td>{$item['id']}</td>
                <td>{$item['name']}</td>
                <td>{if $item['status']==1}已启用{else}已禁用{/if}</td>
                <td>{$item['create_time']}</td>
                <td style="text-align:left;">
                    <a href="{php echo $this->createWebUrl('comment_sign', array('op' => 'post', 'id' => $item['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="修改"><i class="fa fa-edit"></i></a>
                    <a href="{php echo $this->createWebUrl('comment_sign', array('op' => 'delete', 'id' => $item['id']))}" onclick="return confirm('确认删除吗？');return false;" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="删除"><i class="fa fa-times"></i></a>
                </td>
            </tr>
            {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
{elseif $operation == 'post'}

<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" onsubmit='return formcheck()'>
        <input type="hidden" name="id" value="{$commentSign['id']}" />
        <div class="panel panel-default">
            <div class="panel-heading">
                标签设置
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>标签名称</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" id='name' name="name" class="form-control" value="{$commentSign['name']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>是否启用</label>
                    <div class="col-sm-9 col-xs-12">
                        <label class='radio-inline'>
                            <input type='radio' name='status' value='1' {if empty($commentSign['status']) || $commentSign['status']==1}checked{/if} /> 是
                        </label>
                        <label class='radio-inline'>
                            <input type='radio' name='status' value='2' {if $commentSign['status']==2}checked{/if} /> 否
                        </label>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>

<script language='javascript'>
    function formcheck() {
        if ($("#name").val() == '') {
            util.message("请填写标签名称");
            return false;
        }
        return true;
    }
</script>
{/if}
{template 'common/footer'}